package com.livs.mvp;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity implements CounterView {
    private TextView tvCount;
    private CounterPresenter presenter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        tvCount = findViewById(R.id.tvCount);

        presenter = new CounterPresenter(new CounterModel());
        presenter.attachView(this);

        findViewById(R.id.btnIncrease).setOnClickListener(v -> {
            presenter.onIncreaseClicked();
        });
    }

    @Override
    public void refreshPage(int count) {
        tvCount.setText("Count = " + count);
    }
}
